package com.javase.多线程.ThreadLocal;

import org.springframework.boot.web.servlet.server.Session;

/**
 * @Auther: liyanhao
 * @Description: threadLocal使用
 * @Date: 2022/5/18 02:02
 * @Version: v1.0
 */
public class ThreadLocaltest {
    private static final ThreadLocal threadSession = new ThreadLocal();
    public static Session getSession()throws Exception{
        Session s = (Session)threadSession.get();
        if (s == null) {
                s = getSession();
            threadSession.set(s);
        }
        return s;
    }
}
